package com.seguriapp.configuration;

import org.apache.log4j.Logger;

/**
 * Loads the file with the list of Lima postal codes
 */
public class PostalCodeListLoader {

  private static final Logger LOGGER = Logger.getLogger(PostalCodeListLoader.class);

  private PostalCodeList postalCodeList;

  private static final PostalCodeListLoader INSTANCIA = new PostalCodeListLoader();

  /**
   * @return The only instance of the postal code list loader.
   */
  public static PostalCodeListLoader getInstance() {
    return INSTANCIA;
  }

  public void init(Object o) {
    if (o instanceof PostalCodeList) {
      postalCodeList = (PostalCodeList) o;
    } else {
      LOGGER.info("Error loading PostalCodeList file");
    }
  }

  /**
   * @return Postal code list
   */
  public PostalCodeList getPostalCodeList() {
    return postalCodeList;
  }

}
